home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / manageme / tcpdump-.001 / tcpdump-~ / tcpdump-3.0.2-linux / linux-include / netinet / ip.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-30  |  3.9 KB  |  133 lines

  1. /*    @(#)ip.h 1.13 88/08/19 SMI; from UCB 7.6.1.1 3/15/88    */
  2.  
  3. /*
  4.  * Copyright (c) 1982, 1986 Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms are permitted
  8.  * provided that this notice is preserved and that due credit is given
  9.  * to the University of California at Berkeley. The name of the University
  10.  * may not be used to endorse or promote products derived from this
  11.  * software without specific prior written permission. This software
  12.  * is provided ``as is'' without express or implied warranty.
  13.  */
  14.  
  15. /*
  16.  * Definitions for internet protocol version 4.
  17.  * Per RFC 791, September 1981.
  18.  */
  19.  
  20. #ifndef _netinet_ip_h
  21. #define _netinet_ip_h
  22.  
  23. #define    IPVERSION    4
  24.  
  25. /*
  26.  * Structure of an internet header, naked of options.
  27.  *
  28.  * We declare ip_len and ip_off to be short, rather than u_short
  29.  * pragmatically since otherwise unsigned comparisons can result
  30.  * against negative integers quite easily, and fail in subtle ways.
  31.  */
  32. struct ip {
  33. #if defined(vax) || defined(i386)
  34.     u_char    ip_hl:4,        /* header length */
  35.         ip_v:4;            /* version */
  36. #endif
  37. #if defined(mc68000) || defined(sparc)
  38.     u_char    ip_v:4,            /* version */
  39.         ip_hl:4;        /* header length */
  40. #endif
  41.     u_char    ip_tos;            /* type of service */
  42.     short    ip_len;            /* total length */
  43.     u_short    ip_id;            /* identification */
  44.     short    ip_off;            /* fragment offset field */
  45. #define    IP_DF 0x4000            /* dont fragment flag */
  46. #define    IP_MF 0x2000            /* more fragments flag */
  47.     u_char    ip_ttl;            /* time to live */
  48.     u_char    ip_p;            /* protocol */
  49.     u_short    ip_sum;            /* checksum */
  50.     struct    in_addr ip_src,ip_dst;    /* source and dest address */
  51. };
  52.  
  53. #define    IP_MAXPACKET    65535        /* maximum packet size */
  54.  
  55. /*
  56.  * Definitions for options.
  57.  */
  58. #define    IPOPT_COPIED(o)        ((o)&0x80)
  59. #define    IPOPT_CLASS(o)        ((o)&0x60)
  60. #define    IPOPT_NUMBER(o)        ((o)&0x1f)
  61.  
  62. #define    IPOPT_CONTROL        0x00
  63. #define    IPOPT_RESERVED1        0x20
  64. #define    IPOPT_DEBMEAS        0x40
  65. #define    IPOPT_RESERVED2        0x60
  66.  
  67. #define    IPOPT_EOL        0        /* end of option list */
  68. #define    IPOPT_NOP        1        /* no operation */
  69.  
  70. #define    IPOPT_RR        7        /* record packet route */
  71. #define    IPOPT_TS        68        /* timestamp */
  72. #define    IPOPT_SECURITY        130        /* provide s,c,h,tcc */
  73. #define    IPOPT_LSRR        131        /* loose source route */
  74. #define    IPOPT_SATID        136        /* satnet id */
  75. #define    IPOPT_SSRR        137        /* strict source route */
  76.  
  77. /*
  78.  * Offsets to fields in options other than EOL and NOP.
  79.  */
  80. #define    IPOPT_OPTVAL        0        /* option ID */
  81. #define    IPOPT_OLEN        1        /* option length */
  82. #define IPOPT_OFFSET        2        /* offset within option */
  83. #define    IPOPT_MINOFF        4        /* min value of above */
  84.  
  85. /*
  86.  * Time stamp option structure.
  87.  */
  88. struct    ip_timestamp {
  89.     u_char    ipt_code;        /* IPOPT_TS */
  90.     u_char    ipt_len;        /* size of structure (variable) */
  91.     u_char    ipt_ptr;        /* index of current entry */
  92. #if defined(vax) || defined(i386)
  93.     u_char    ipt_flg:4,        /* flags, see below */
  94.         ipt_oflw:4;        /* overflow counter */
  95. #endif
  96. #if defined(mc68000) || defined(sparc)
  97.     u_char    ipt_oflw:4,        /* overflow counter */
  98.         ipt_flg:4;        /* flags, see below */
  99. #endif
  100.     union ipt_timestamp {
  101.         n_long    ipt_time[1];
  102.         struct    ipt_ta {
  103.             struct in_addr ipt_addr;
  104.             n_long ipt_time;
  105.         } ipt_ta[1];
  106.     } ipt_timestamp;
  107. };
  108.  
  109. /* flag bits for ipt_flg */
  110. #define    IPOPT_TS_TSONLY        0        /* timestamps only */
  111. #define    IPOPT_TS_TSANDADDR    1        /* timestamps and addresses */
  112. #define    IPOPT_TS_PRESPEC    2        /* specified modules only */
  113.  
  114. /* bits for security (not byte swapped) */
  115. #define    IPOPT_SECUR_UNCLASS    0x0000
  116. #define    IPOPT_SECUR_CONFID    0xf135
  117. #define    IPOPT_SECUR_EFTO    0x789a
  118. #define    IPOPT_SECUR_MMMM    0xbc4d
  119. #define    IPOPT_SECUR_RESTR    0xaf13
  120. #define    IPOPT_SECUR_SECRET    0xd788
  121. #define    IPOPT_SECUR_TOPSECRET    0x6bc5
  122.  
  123. /*
  124.  * Internet implementation parameters.
  125.  */
  126. #define    MAXTTL        255        /* maximum time to live (seconds) */
  127. #define    IPFRAGTTL    60        /* time to live for frags, slowhz */
  128. #define    IPTTLDEC    1        /* subtracted when forwarding */
  129.  
  130. #define    IP_MSS        576        /* default maximum segment size */
  131.  
  132. #endif /*!_netinet_ip_h*/
  133.